package com.bitcat.firstapp.demo.broadcastdemo

import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.bitcat.firstapp.databinding.ActivityBroadcastTwoBinding

class BroadcastTwoActivity : AppCompatActivity() {

    private val binding: ActivityBroadcastTwoBinding by lazy {
        ActivityBroadcastTwoBinding.inflate(layoutInflater)
    }
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(binding.root)


        binding.btnSendBroadcast.setOnClickListener {
            val intent = Intent("com.bitcat.message")
            intent.putExtra("name","zhangsan")
            sendBroadcast(intent) // 发送广播
        }
    }
}